Talk to the Cityのクラスタリング
2024-05-26
これが内部的にHDBSCANとUMAPを使うようだ
HDBSCAN - Hierarchical Density-Based Spatial Clustering of Applications with Noise. Performs DBSCAN over varying epsilon values and integrates the result to find a clustering that gives the best stability over epsilon. This allows HDBSCAN to find clusters of varying densities (unlike DBSCAN), and be more robust to parameter selection. 2025-06-06
o3.iconに解説させる
処理フロー
UMAP で高次元埋め込みを 2 次元に射影
HDBSCAN + BERTopic で 「トピックの確率」 を推定
射影後の 2D 座標を使って Spectral Clustering で 「最終クラスタ」 を決定
結果を clusters.csv に保存(各 argument を x–y 位置・確率・cluster-id 付きで出力)
code::
cluster_labels = spectral_model.fit_predict(umap_embeds)
result = topic_model.get_document_info(
docs=docs,
metadata={
**metadatas,
},
)
code::
result = result'arg-id', 'x', 'y', 'probability'